package com.gxuwz.nio;

import com.sun.nio.sctp.SctpStandardSocketOptions;

import java.io.IOException;
import java.net.InetSocketAddress;
import java.nio.ByteBuffer;
import java.nio.channels.SocketChannel;

public class SocketChannelDemo {
    public static void main(String[] args) throws IOException {
        SocketChannel sc=SocketChannel.open(new InetSocketAddress("www.baidu.com",80));

        ByteBuffer buffer=ByteBuffer.allocate(48);

        //设置是否阻塞
        sc.configureBlocking(false);

//        sc.setOption(SctpStandardSocketOptions.SO_SNDBUF)
        sc.read(buffer);
        sc.close();
        System.out.println("reader over");
    }
}
